package com.shuzijun.leetcode.editor.cn;
public class HammingDistance{
    public static void main(String[] args) {
         Solution solution = new HammingDistance().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    public int hammingDistance(int x, int y) {
        int r = x ^y;
        int mask = 1;
        int count = 0;
        for (int i = 0; i < 31; i++) {
            if ((r&mask) != 0) count++;
            mask *= 2;
        }
        return count;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}